<template>
	<view>
		<template v-if="hasStart == 1">
			<template v-if="pageModuleName('index')">
				<sww-page-index ref="modulePageRef" :tabIndex="tabIndex"></sww-page-index>
			</template>
			<template v-else-if="pageModuleName('video')">
				<sww-page-video ref="modulePageRef"></sww-page-video>
			</template>
			<template v-else-if="pageModuleName('prodExchange')">
				<sww-page-prodExchange ref="modulePageRef"></sww-page-prodExchange>
			</template>
			<template v-else-if="pageModuleName('cardExchange')">
				<sww-page-cardExchange ref="modulePageRef"></sww-page-cardExchange>
			</template>
		</template>
		<view class="start_img" v-else-if="hasStart == 2">
			<image :src="vuex_business.start_pic" class="start_all" mode="aspectFill"></image>
		</view>
		<sww-tab-bar v-show="hasStart == 1" :isVideo="pageModuleName('video')" ref="tabBarRef"></sww-tab-bar>
	</view>
</template>
<script>
	import { tabPage } from '../../mixins/tabPage';
	export default {
		mixins: [tabPage],
		data() {
			return {
				hasStart: 3,
				tabIndex: 0,
				homeCount: 4,
				time: null
			};
		},
		components:{
		},
		methods: {
			startInit() {
				if (this.vuex_business.start_pic) {
					this.hasStart = 2
					this.countTime()
				} else {
					this.goHome()
				}
			},
			countTime() {
				if (this.homeCount <= 0) {
					this.goHome()
				} else {
					this.time = setTimeout(() => {
						this.homeCount -= 1
						this.countTime()
					}, 1000)
				}
			},
			goHome() {
				if (this.time) {
					clearTimeout(this.time)
				}
				this.hasStart = 1
				this.initLoad()
			},
		}
	};
</script>
<style scoped lang="scss">
	.start_img {
		height: 100vh;
		position: relative;

		.start_all {
			width: 100%;
			height: 100%;
		}

		.jumnp_sign {
			position: absolute;
			right: 60rpx;
			top: 170rpx;
			font-size: 24rpx;
			background-color: rgba(168, 168, 168, 0.7);
			padding: 6rpx 36rpx;
			border-radius: 30rpx;
			color: #fff;
		}
	}
</style>
